<?php
    header('Access-Control-Allow-Origin:*');
    header("content-type:text/html;charset=utf-8");
    if($_POST){
        $table_name = 'controller'.$_POST['project_id'];
        $row_id = $_POST['id'];
        $row_type = $_POST['type'];
        $row_name = $_POST['name'];
        $row_address = $_POST['address'];
        $row_data_type = $_POST['data_type'];
        $row_value = $_POST['value'];
        $row_priority = $_POST['priority'];
        $row_room = $_POST['room'];
        $row_room_desc = $_POST['room_desc'];
        // print_r ($row_room_desc);
        $db_con = mysqli_connect('localhost','root','');
        if($db_con){
            $result = mysqli_query($db_con,'set names utf8');
            $result = mysqli_query($db_con,'use sx_control');
            $sql = "update $table_name set type='$row_type',name='$row_name',address='$row_address',data_type='$row_data_type',
                    value='$row_value',priority='$row_priority',room='$row_room',room_desc='$row_room_desc' where id='$row_id'";
            $result = mysqli_query($db_con,$sql);
            $sql = "select * from controller where id='$row_id'";
            $result = mysqli_query($db_con,$sql);
            $data = mysqli_fetch_assoc($result);        
            print_r($data);
            mysqli_close($db_con);
        } else {
            die ('数据库连接失败');
        }
    }
?>